<!--
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author XPF
-->
<template>
  <div>
    <BasicModal
      v-bind="$attrs"
      width="1000px"
      @register="registerModal"
      :showOkBtn="false"
      :showCancelBtn="false"
    >
      <template #title>
        <span> {{ getTitle.value }} </span>
      </template>
      <div style="height: 500px">
        <video :src="VideoPath" controls width="850" height="400" style="margin: 0 auto"></video>
      </div>
    </BasicModal>
  </div>
</template>
<script lang="ts">
  export default defineComponent({
    name: 'ViewSportsSportsWeightAdditionalModal',
  });
</script>
<script lang="ts" setup>
  import { defineComponent, ref, computed } from 'vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { ExercisePrescription } from '/@/api/physical/exercisePrescription';
  const { showMessage } = useMessage();
  const emit = defineEmits(['success', 'register']);
  const { t } = useI18n('sports.sportsWeight');
  const record = ref<ExercisePrescription>({} as ExercisePrescription);
  const getTitle = computed(() => ({
    value: t('预览'),
  }));
  const VideoPath = ref();
  const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
    setModalProps({ loading: true });
    console.log(data.prescriptionVideoPath.substring(0, data.prescriptionVideoPath.indexOf('?')));
    VideoPath.value = data.prescriptionVideoPath.substring(
      0,
      data.prescriptionVideoPath.indexOf('?'),
    );
    setModalProps({ loading: false });
  });
  // function handleSubmit() {
  //   emit('success');
  //   closeModal();
  // }
</script>
